#!/bin/bash

if [ -z "$1" ]
then
  echo "*** Expected a directory."
  exit 1
fi

if [ ! -d "$1/bin" ]
then
  echo "*** Install path is not valid, cannot find directory:"
  echo "    $1/bin"
  exit 1
fi

cp ./apply_template.sh $1/bin
chmod +x $1/bin/apply_template.sh

if [ ! -x "$1/bin/apply_template.sh" ]
then
  echo "*** Installation failed."
  exit 1
fi

echo "*** Installation OK."

exit 0

